home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap11 / howto05 / cciccprf.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-22  |  6.7 KB  |  223 lines

  1. unit Cciccprf;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, FileCtrl, TabNotBk, StdCtrls, Buttons, ExtCtrls, ComCtrls;
  8.  
  9. type
  10.   TCCICPrefsDlg = class(TForm)
  11.     TabbedNotebook1: TTabbedNotebook;
  12.     OKBtn: TBitBtn;
  13.     CancelBtn: TBitBtn;
  14.     HelpBtn: TBitBtn;
  15.     RadioGroup1: TRadioGroup;
  16.     RadioGroup2: TRadioGroup;
  17.     RadioGroup3: TRadioGroup;
  18.     RadioGroup4: TRadioGroup;
  19.     RadioGroup5: TRadioGroup;
  20.     RadioGroup6: TRadioGroup;
  21.     Edit1: TEdit;
  22.     Label1: TLabel;
  23.     CheckBox1: TCheckBox;
  24.     RadioGroup7: TRadioGroup;
  25.     RadioGroup8: TRadioGroup;
  26.     RadioGroup9: TRadioGroup;
  27.     RadioGroup10: TRadioGroup;
  28.     CheckBox2: TCheckBox;
  29.     OpenDialog1: TOpenDialog;
  30.     Label8: TLabel;
  31.     Edit6: TEdit;
  32.     Button6: TButton;
  33.     Label9: TLabel;
  34.     Edit7: TEdit;
  35.     Button7: TButton;
  36.     Label11: TLabel;
  37.     Edit9: TEdit;
  38.     Button9: TButton;
  39.     CheckBox3: TCheckBox;
  40.     procedure OKBtnClick(Sender: TObject);
  41.     procedure FormShow(Sender: TObject);
  42.     procedure Button6Click(Sender: TObject);
  43.     procedure Button7Click(Sender: TObject);
  44.     procedure Button9Click(Sender: TObject);
  45.   private
  46.     { Private declarations }
  47.   public
  48.     { Public declarations }
  49.   end;
  50.  
  51. var
  52.   CCICPrefsDlg: TCCICPrefsDlg;
  53.  
  54. implementation
  55.  
  56. {$R *.DFM}
  57. uses CCICCFrm;
  58.  
  59. procedure TCCICPrefsDlg.OKBtnClick(Sender: TObject);
  60. begin
  61.   case Tag of
  62.     2 : begin
  63.           if CheckBox1.Checked then
  64.           begin
  65.             PasswordControlVector := 1;
  66.           end
  67.           else
  68.           begin
  69.             PassWordControlVector := 2;
  70.           end;
  71.           case RadioGroup6.ItemIndex of
  72.             0 : DefaultDownloadVector := 3;
  73.             1 : begin
  74.                   case RadioGroup5.ItemIndex of
  75.                     0 : DefaultDownloadVector := 2;
  76.                     1 : DefaultDownloadVector := 1;
  77.                   end;
  78.                 end;
  79.           end;
  80.           try
  81.             TheAnonRedialVector := StrToInt( Edit1.Text );
  82.             if TheAnonRedialVector < 1 then TheAnonRedialVector := 1;
  83.             if TheAnonRedialVector > 50 then TheAnonRedialVector := 50;
  84.           except
  85.             On EConvertError do
  86.             begin
  87.               TheAnonRedialVector := 20;
  88.             end;
  89.           end;
  90.         end;
  91.     3 : begin
  92.           if Edit6.Text[ Length( Edit6.Text ) ] = '\' then
  93.            Edit6.Text := Copy( Edit6.Text , 1 , (Length( Edit6.Text ) - 1 ));
  94.           if DirectoryExists( Edit6.Text ) then
  95.            MailPath := Edit6.Text;
  96.           if Edit7.Text[ Length( Edit7.Text ) ] = '\' then
  97.            Edit7.Text := Copy( Edit7.Text , 1 , (Length( Edit7.Text ) - 1 ));
  98.           if DirectoryExists( Edit6.Text ) then
  99.            NewsPath := Edit7.Text;
  100.           if Edit9.Text[ Length( Edit9.Text ) ] = '\' then
  101.            Edit9.Text := Copy( Edit9.Text , 1 , (Length( Edit9.Text ) - 1 ));
  102.           if DirectoryExists( Edit9.Text ) then
  103.            FTPPath := Edit9.Text;
  104.         end;
  105.     4 : begin
  106.           if CheckBox2.Checked then NewsInitialUpdateVector := 1 else
  107.            NewsInitialUpdateVector := 2;
  108.           NewsReadArticlePurgingVector := RadioGroup7.ItemIndex + 1;
  109.           NewsReadArticleDisplayVector := RadioGroup8.ItemIndex + 1;
  110.           NewsUUMIMEVector := RadioGroup9.ItemIndex + 1;
  111.           NewsPostQueueingVector := RadioGroup10.ItemIndex + 1;
  112.         end;
  113.     6 : begin { Email options }
  114.           if CheckBox3.Checked then EMPasswordControlVector := 1 else
  115.            EMPasswordControlVector := 2;
  116.           EMRemoteDeletionVector := RadioGroup1.ItemIndex + 1;
  117.           EMChokeVector := RadioGroup2.ItemIndex + 1;
  118.           EMDefaultDownloadVector := RadioGroup3.ItemIndex + 1;
  119.           EMQueueVector := RadioGroup4.ItemIndex + 1;
  120.         end;
  121.   end;
  122. end;
  123.  
  124. procedure TCCICPrefsDlg.FormShow(Sender: TObject);
  125. begin
  126.   case Tag of
  127.     2 : begin
  128.           case PasswordControlVector of
  129.             1 : CheckBox1.Checked := true;
  130.             2 : CheckBox1.Checked := false;
  131.           end;
  132.           case DefaultDownloadVector of
  133.             1 : begin
  134.                   RadioGroup5.ItemIndex := 1;
  135.                   RadioGroup6.ItemIndex := 1;
  136.                 end;
  137.             2 : begin
  138.                   RadioGroup5.ItemIndex := 0;
  139.                   RadioGroup6.ItemIndex := 1;
  140.                 end;
  141.             3 : begin
  142.                   RadioGroup5.ItemIndex := 0;
  143.                   RadioGroup6.ItemIndex := 0;
  144.                 end;
  145.           end;
  146.           Edit1.Text := IntToStr( TheAnonRedialVector );
  147.         end;
  148.     3 : begin
  149.           Edit6.Text := Mailpath;
  150.           Edit7.Text := NewsPath;
  151.           Edit9.Text := FTPPath;
  152.         end;
  153.     4 : begin
  154.           case NewsInitialUpdateVector of
  155.             1 : CheckBox2.Checked := true;
  156.             2 : CheckBox2.Checked := false;
  157.           end;
  158.           RadioGroup7.ItemIndex := NewsReadArticlePurgingVector - 1;
  159.           RadioGroup8.ItemIndex := NewsReadArticleDisplayVector - 1;
  160.           RadioGroup9.ItemIndex := NewsUUMIMEVector - 1;
  161.           RadioGroup10.ItemIndex := NewsPostQueueingVector - 1;
  162.         end;
  163.     6 : begin { Email options }
  164.           case EMPasswordControlVector of
  165.             1 : CheckBox3.Checked := true;
  166.             2 : CheckBox3.Checked := false;
  167.           end;
  168.           case EMRemoteDeletionVector of
  169.             1 : begin
  170.                   RadioGroup1.ItemIndex := 0;
  171.                 end;
  172.             2 : begin
  173.                   RadioGroup1.ItemIndex := 1;
  174.                 end;
  175.           end;
  176.           case EMChokeVector of
  177.             1 : begin
  178.                   RadioGroup2.ItemIndex := 0;
  179.                 end;
  180.             2 : begin
  181.                   RadioGroup2.ItemIndex := 1;
  182.                 end;
  183.           end;
  184.           case EMDefaultDownloadVector of
  185.             1 : begin
  186.                   RadioGroup3.ItemIndex := 0;
  187.                 end;
  188.             2 : begin
  189.                   RadioGroup3.ItemIndex := 1;
  190.                 end;
  191.           end;
  192.           case EMQueueVector of
  193.             1 : begin
  194.                   RadioGroup4.ItemIndex := 0;
  195.                 end;
  196.             2 : begin
  197.                   RadioGroup4.ItemIndex := 1;
  198.                 end;
  199.           end;
  200.         end;
  201.   end;
  202. end;
  203.  
  204. procedure TCCICPrefsDlg.Button6Click(Sender: TObject);
  205. begin
  206.   if OpenDialog1.Execute then
  207.    Edit6.Text := ExtractfilePath( OpenDialog1.FileName );
  208. end;
  209.  
  210. procedure TCCICPrefsDlg.Button7Click(Sender: TObject);
  211. begin
  212.   if OpenDialog1.Execute then
  213.    Edit7.Text := ExtractfilePath( OpenDialog1.FileName );
  214. end;
  215.  
  216. procedure TCCICPrefsDlg.Button9Click(Sender: TObject);
  217. begin
  218.   if OpenDialog1.Execute then
  219.    Edit9.Text := ExtractfilePath( OpenDialog1.FileName );
  220. end;
  221.  
  222. end.
  223.